<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Tabs（懒加载）</title>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link href="<%=path%>/static/miniui/themes/default/demo.css"
	rel="stylesheet" type="text/css" />


<script src="<%=path%>/static/miniui/boot.js" type="text/javascript"></script>
<style type="text/css">
body {
	margin: 0;
	padding: 0;
	border: 0;
	width: 100%;
	height: 100%;
	overflow: hidden;
}

.header {
	background: url(../header.gif) repeat-x 0 -1px;
}
</style>
</head>
<body>

	<!--Layout-->
	<div id="layout1" class="mini-layout"
		style="width: 100%; height: 100%;">
		<!-- <div class="header" region="north" height="70" showSplit="false"
			showHeader="false"> -->
			<!-- <h1
				style="margin: 0; padding: 15px; cursor: default; font-family: 'Trebuchet MS', Arial, sans-serif;">导航树（左侧）</h1> -->
			<!-- <div style="position:absolute;top:18px;right:10px;">
            <a class="mini-button mini-button-iconTop" iconCls="icon-add" onclick="onQuickClick" plain="true">快捷</a>    
            <a class="mini-button mini-button-iconTop" iconCls="icon-edit" onclick="onClick"  plain="true" >首页</a>        
            <a class="mini-button mini-button-iconTop" iconCls="icon-date" onclick="onClick"  plain="true" >消息</a>        
            <a class="mini-button mini-button-iconTop" iconCls="icon-edit" onclick="onClick"  plain="true" >设置</a>        
            <a class="mini-button mini-button-iconTop" iconCls="icon-close" onclick="onClick"  plain="true" >关闭</a>        
            
        </div> -->
		<!-- </div> -->
		<!--  <div title="south" region="south" showSplit="false" showHeader="false"
			height="30">
			<div style="line-height: 28px; text-align: center; cursor: default">Copyright
				© 上海普加软件有限公司版权所有</div>
		</div> -->
		<div title="center" region="center" bodyStyle="overflow:hidden;"
			style="border: 0;">
			<!--Splitter-->
			<!--   <div class="mini-splitter" style="width:100%;height:100%;" borderStyle="border:0;"> -->
			
			<%-- <div size="180" maxSize="250" minSize="100" showCollapseButton="true" style="border-width:1px;">
                <!--Tree-->
                <ul id="leftTree" class="mini-tree" url="<%=path %>/static/miniui/data/listTree.txt" style="width:100%;height:100%;" 
                    showTreeIcon="true" textField="text" idField="id" resultAsTree="false"  
                    onnodeselect="onNodeSelect" showTreeLines="false"
                >        
                </ul>  
            </div>  --%>
			<div showCollapseButton="false" style="border: 0px;">
				<!--Tabs-->
				<div id="tabs1" class="mini-tabs" activeIndex="0"
					style="width: 100%; height: 650px;"
					url=" <%=path%>/static/miniui/data/tabs.txt"></div>

			</div>
		</div>
	</div>
	<!-- </div> -->

	<script type="text/javascript">
		mini.parse();
		var tabs = mini.get("tabs1");

		function loadTabs() {
			tabs.load("tabs.txt");
		}

		var index = 1;
		function addTab() {
			//add tab
			var i = index++;

			var tab = {
				title : "tab" + i,
				url : 'pages/page' + i + '.html',
				showCloseButton : true
			};
			tab.ondestroy = function(e) {
				var tabs = e.sender;
				var iframe = tabs.getTabIFrameEl(e.tab);

				//获取子页面返回数据
				var pageReturnData = iframe.contentWindow.getData ? iframe.contentWindow
						.getData()
						: "";

				alert(e.tab.removeAction + " : " + pageReturnData);

				//如果禁止销毁的时候，自动active一个新tab：e.autoActive = false;
			}
			tabs.addTab(tab);

			//active tab
			tabs.activeTab(tab);

		}
		function removeTab() {
			var tab = tabs.getActiveTab();
			if (tab) {
				tabs.removeTab(tab);
			}
		}

		function onTabDestroy(e) {
			//alert(e.tab.removeAction);
		}

		function loadTab() {
			var tab = tabs.getActiveTab();
			tabs.loadTab("pages/page1.html", tab);
		}

		tabs.on("beforecloseclick", function(e) {
			if (e.tab.title == "Tab2") {
				alert("Tab2不能关闭");
				e.cancel = true;
			}
		});

		/* function showTab(node) {
		    var tabs = mini.get("mainTabs");

		    var id = "tab$" + node.id;
		    var tab = tabs.getTab(id);
		    if (!tab) {
		        tab = {};
		        tab._nodeid = node.id;
		        tab.name = id;
		        tab.title = node.text;
		        tab.showCloseButton = true;

		        //这里拼接了url，实际项目，应该从后台直接获得完整的url地址
		        tab.url = mini_JSPath + "../../docs/api/" + node.id + ".html";

		        tabs.addTab(tab);
		    }
		    tabs.activeTab(tab);
		}
		 */
		/*  var tree = mini.get("leftTree");
		       function onNodeSelect(e) {
		
		           var node = e.node;
		           mini.alert("node=="+node.id+"  url=="+node.url+"  isLeaf=="+e.isLeaf);
		            mini.load(node.url);
		           //mini.open(node.url);       
		           var isLeaf = e.isLeaf;

		          
		       }

		       function onClick(e) {
		           var text = this.getText();
		           alert(text);
		       }
		       function onQuickClick(e) {
		           tree.expandPath("datagrid");
		           tree.selectNode("datagrid");
		       }

		       function onTabsActiveChanged(e) {
		           var tabs = e.sender;
		           var tab = tabs.getActiveTab();
		           if (tab && tab._nodeid) {

		               var node = tree.getNode(tab._nodeid);
		               if (node && !tree.isSelectedNode(node)) {
		                   tree.selectNode(node);
		               }
		           }
		       } */
	</script>

</body>
</html>